home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 May / Ahoy_Magazine_87-05_1987_Double_L_Side_A.d64 / Phrase Reverser (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1987-01-01  |  534 b   |  18 lines

  1. 0 rem << cd41-9 >>
  2. 1 rem ==================================
  3. 2 rem    commodares problem #37-4 :
  4. 3 rem    phrase reverser
  5. 4 rem    solution by
  6. 5 rem    paul parker
  7. 6 rem ==================================
  8. 9 rem --- novice solution ---
  9. 10 input"[147]phrase";s$:fora=len(s$)to1step-1:r$=r$+mid$(s$,a,1):next:printr$
  10. 20 print"type - run 110 - for expert solution" : stop
  11. 100 rem --- expert solution ---
  12. 110 input"word(s) to reverse";s$
  13. 120 fora=1tolen(s$):r$=mid$(s$,a,1):ifr$=" "then 140
  14. 130 sr$=sr$+r$ : next a
  15. 140 for b=len(sr$)to1step-1:printmid$(sr$,b,1);:next:print" ";:sr$=""
  16. 150 if a>len(s$) then end
  17. 160 next
  18.